#include <stdio.h>
#include <ctype.h>

#define N 15

int main() {
	char phone[N] = { 0 };
	char ch;
	int index = 0;

	printf("Enter phone number: ");

	while ((ch = getchar()) != '\n')	
	{
		if (isalpha(ch))
		{
			ch = toupper(ch);
			switch (ch)
			{
			case 'A':
			case 'B':
			case 'C':
				ch = '2';
				break;
			case 'D':
			case 'E':
			case 'F':
				ch = '3';
				break;
			case 'G':
			case 'H':
			case 'I':
				ch = '4';
				break;
			case 'J':
			case 'K':
			case 'L':
				ch = '5';
				break;
			case 'M':
			case 'N':
			case 'O':
				ch = '6';
				break;
			case 'P':
			case 'Q':
			case 'R':
			case 'S':
				ch = '7';
				break;
			case 'T':
			case 'U':
			case 'V':
				ch = '8';
				break;
			case 'W':
			case 'X':
			case 'Y':
			case 'Z':
				ch = '9';
				break;
			default:
				break;
			}
		}
		
		phone[index++] = ch;
	}

	printf("In numeric form: ");
	for (int i = 0; i < index; i++)
	{
		putchar(phone[i]);
	}
	printf("\n");

	return 0;
}